package barcode.android.internet.impl;

import junit.framework.Assert;
import android.test.ActivityInstrumentationTestCase2;
import barcode.android.activity.Barcode_androidActivity;
import barcode.android.internet.AccountInternet;

public class AccountInternetTest extends
		ActivityInstrumentationTestCase2<Barcode_androidActivity> {
	private AccountInternet net = new AccountInternetImpl();

	public AccountInternetTest() {
		super(Barcode_androidActivity.class);
	}

	public void testSignUp() throws Exception {
		InternetResult res = net.signUp("u200810002", "123456");
		Assert.assertEquals(ResultType.Success, res.getType());
	}

	public void testLogin() throws Exception {
		InternetResult res = net.login("U200810002", "123456");
		Assert.assertEquals(ResultType.Success, res.getType());
	}

	public void testCheck() throws Exception {
		InternetResult res = net.check("u200810001", "朱蓉蓉");
		Assert.assertEquals(ResultType.Success, res.getType());
	}

	public void testChangePassword() throws Exception {
		InternetResult res = net.login("u200810001", "123456");
		Assert.assertEquals(ResultType.Success, res.getType());
		res = net
				.changePassword("u200810001", "12345", (String) res.getValue());
		Assert.assertEquals(ResultType.Success, res.getType());
	}
}
